<template>
	<view class="main-cont box box-tb box-pack-start box-align-center">
		<view class="list box box-align-center box-pack-start mt20">
			<u-input v-model="search" type="text" :border="border"
				:custom-style="customStyle" placeholder="搜索学校" />
				<u-image src="@/static/class/icon_search.png" width="34rpx" height="34rpx" @click="goSearch">
					<u-loading></u-loading>
				</u-image>
		</view>
		
		<view class="padd20 school">
			<view class="items" v-for="(item,index) in page.list" :key="index" @click="goIndex(item)">
				{{item.name}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				search:"",
				customStyle: {
					width:"560rpx",
					padding: "40rpx",
					color: "#fff"
				},
                page: {
                    total: 0,
                    pageSize: 10,
                    pageNum: 1,
                    list: []
                }
			}
		},
		onLoad() {
			//console.log();
		},
		methods: {
			goSearch(pageNum) {
				let params = {
					searchText:this.search,
					pageNum:pageNum
				}
				this.$u.api.getSchoolList(params).then(res => {
					this.page = res.list;
				})
			},
			goIndex(data) {
				uni.navigateTo({
					url:`/pages/index/index?id=${data.id}&name=${data.name}`
				})
			}
		}
	}
</script>

<style scoped lang='scss'>
	.main-cont {
		width: 100%;
		height: 100%;
		overflow-y: auto;
	}
	.list {
		width: 710rpx;
		height: 86rpx;
		background: #F3F4FB;
		border-radius: 43rpx;
	}
	.school {
		width: 100%;
	}
	.items {
		width: 100%;
		height: 95rpx;
		line-height: 95rpx;
		color: #2F3142;
		font-size: 30rpx;
		text-align: left;
	}
</style>
